<template>
	<view class="content">
		修改页面
		<table>
			<tr>
				<td>店铺名称</td>
				<td><input type="text" v-model="StoreName" style="background-color: antiquewhite;"></td>
			</tr>
			<tr>
				<td>门店店长</td>
				<td><input type="text" v-model="StoreManager" style="background-color: antiquewhite;"></td>
			</tr>
			<tr>
				<td>门店地址</td>
				<td><input type="text" v-model="StoreAddress" style="background-color: antiquewhite;"></td>
			</tr>
			<tr>
				<td>详细地址</td>
				<td><input type="text" v-model="ShowAddress" style="background-color: antiquewhite;"></td>
			</tr>
		</table>
		<button @click="update()">修改</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				id :0 ,
				StoreName :"",
				StoreManager :"",
				StoreAddress :"",
				ShowAddress :"",
			}
		},
		onLoad(id) {
			this.id =id.id
			this.show()
		},
		methods: {
			update(){
				uni.request({
				    url: 'http://127.0.0.1:8080/update', //仅为示例，并非真实接口地址。
				    data: {
						id : this.id,
				        StoreName : this.StoreName,
				        StoreManager : this.StoreManager,
				        StoreAddress : this.StoreAddress,
				        ShowAddress : this.ShowAddress,
				    },
					method:"POST",
				    header: {
				        'content-type': 'application/x-www-form-urlencoded' //自定义请求头信息
				    },
				    success: (res) => {
				        console.log(res.data)
						if (res.data.Cre==200) {
							alert("修改成功")
							uni.navigateTo({
								url:"/pages/index/index"
							})
						}
				    }
				});
			},
			show(){
				uni.request({
				    url: 'http://127.0.0.1:8080/show', //仅为示例，并非真实接口地址。
				    data: {
						id : this.id
				    },
					method:"GET",
				    header: {
				        'content-type': 'application/x-www-form-urlencoded' //自定义请求头信息
				    },
				    success: (res) => {
				        console.log(res.data)
						this.StoreName  =res.data.Data.StoreName,
						this.StoreManager  =res.data.Data.StoreManager,
						this.StoreAddress  =res.data.Data.StoreAddress,
						this.ShowAddress  =res.data.Data.ShowAddress
				    }
				});
			},
		}
	}
</script>

<style>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.logo {
		height: 200rpx;
		width: 200rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}

	.text-area {
		display: flex;
		justify-content: center;
	}

	.title {
		font-size: 36rpx;
		color: #8f8f94;
	}
</style>
